/**
 * @author 
 * @createtime 
 * @class ProjectAttendInfoForm
 * @extends Ext.Window
 * @description ProjectAttendInfo表单
 */
ProjectAttendInfoForm=Ext.extend(Ext.Window,{
	//内嵌FormPanel
	formPanel:null,
	//构造函数
	constructor:function(_cfg){
		Ext.applyIf(this,_cfg);
		//必须先初始化组件
		this.initUIComponents();
		ProjectAttendInfoForm.superclass.constructor.call(this,{
			id:'ProjectAttendInfoFormWin',
			layout:'fit',
			items:this.formPanel,
			modal:true,
			height:200,
			width:400,
			maximizable:true,
			title:'[ProjectAttendInfo]详细信息',
			buttonAlign : 'center',
			buttons:this.buttons
		});
	},//end of the constructor
	//初始化组件
	initUIComponents:function(){
		this.formPanel=new Ext.FormPanel({
				layout : 'form',
				trackResetOnLoad:true,
				bodyStyle: 'padding:10px 10px 10px 10px',
				border:false,
				url : __ctxPath + '/produce/saveProjectAttendInfo.do',
				id : 'ProjectAttendInfoForm',
				defaults : {
					anchor : '98%,98%'
				},
				defaultType : 'textfield',
				items : [{
							name : 'projectAttendInfo.id',
							id : 'id',
							xtype:'hidden',
							value : this.id == null ? '' : this.id
						}
																																										,{
												fieldLabel : '',	
												name : 'projectAttendInfo.attendId',
						id : 'attendId'
							}
																																				,{
												fieldLabel : '姓名',	
												name : 'projectAttendInfo.name',
						id : 'name'
							}
																																				,{
												fieldLabel : '职务',	
												name : 'projectAttendInfo.duty',
						id : 'duty'
							}
																																				,{
												fieldLabel : '考勤日期',	
												name : 'projectAttendInfo.day1',
						id : 'day1'
							}
																																				,{
												fieldLabel : '状态',	
												name : 'projectAttendInfo.day2',
						id : 'day2'
							}
																																				,{
												fieldLabel : '',	
												name : 'projectAttendInfo.day3',
						id : 'day3'
							}
																																				,{
												fieldLabel : '',	
												name : 'projectAttendInfo.day4',
						id : 'day4'
							}
																																				,{
												fieldLabel : '',	
												name : 'projectAttendInfo.day5',
						id : 'day5'
							}
																																				,{
												fieldLabel : '',	
												name : 'projectAttendInfo.day6',
						id : 'day6'
							}
																																				,{
												fieldLabel : '',	
												name : 'projectAttendInfo.day7',
						id : 'day7'
							}
																																				,{
												fieldLabel : '',	
												name : 'projectAttendInfo.day8',
						id : 'day8'
							}
																																				,{
												fieldLabel : '',	
												name : 'projectAttendInfo.day9',
						id : 'day9'
							}
																																				,{
												fieldLabel : '',	
												name : 'projectAttendInfo.day10',
						id : 'day10'
							}
																																				,{
												fieldLabel : '',	
												name : 'projectAttendInfo.day11',
						id : 'day11'
							}
																																				,{
												fieldLabel : '',	
												name : 'projectAttendInfo.day12',
						id : 'day12'
							}
																																				,{
												fieldLabel : '',	
												name : 'projectAttendInfo.day13',
						id : 'day13'
							}
																																				,{
												fieldLabel : '',	
												name : 'projectAttendInfo.day14',
						id : 'day14'
							}
																																				,{
												fieldLabel : '',	
												name : 'projectAttendInfo.day15',
						id : 'day15'
							}
																																				,{
												fieldLabel : '',	
												name : 'projectAttendInfo.day16',
						id : 'day16'
							}
																																				,{
												fieldLabel : '',	
												name : 'projectAttendInfo.day17',
						id : 'day17'
							}
																																				,{
												fieldLabel : '',	
												name : 'projectAttendInfo.day18',
						id : 'day18'
							}
																																				,{
												fieldLabel : '',	
												name : 'projectAttendInfo.day19',
						id : 'day19'
							}
																																				,{
												fieldLabel : '',	
												name : 'projectAttendInfo.day20',
						id : 'day20'
							}
																																				,{
												fieldLabel : '',	
												name : 'projectAttendInfo.day21',
						id : 'day21'
							}
																																				,{
												fieldLabel : '',	
												name : 'projectAttendInfo.day22',
						id : 'day22'
							}
																																				,{
												fieldLabel : '',	
												name : 'projectAttendInfo.day23',
						id : 'day23'
							}
																																				,{
												fieldLabel : '',	
												name : 'projectAttendInfo.day24',
						id : 'day24'
							}
																																				,{
												fieldLabel : '',	
												name : 'projectAttendInfo.day25',
						id : 'day25'
							}
																																				,{
												fieldLabel : '',	
												name : 'projectAttendInfo.day26',
						id : 'day26'
							}
																																				,{
												fieldLabel : '',	
												name : 'projectAttendInfo.day27',
						id : 'day27'
							}
																																				,{
												fieldLabel : '',	
												name : 'projectAttendInfo.day28',
						id : 'day28'
							}
																																				,{
												fieldLabel : '',	
												name : 'projectAttendInfo.day29',
						id : 'day29'
							}
																																				,{
												fieldLabel : '',	
												name : 'projectAttendInfo.day30',
						id : 'day30'
							}
																																				,{
												fieldLabel : '',	
												name : 'projectAttendInfo.day31',
						id : 'day31'
							}
																								
												]
			});
		//加载表单对应的数据	
		this.initData();
		//初始化功能按钮
		this.buttons=[{
				text : '保存',
				iconCls : 'btn-save',
				handler :this.save.createCallback(this.formPanel,this)
			}, {
				text : '重置',
				iconCls : 'btn-reset',
				handler :this.reset.createCallback(this.formPanel)
			},{
				text : '取消',
				iconCls : 'btn-cancel',
				handler : this.cancel.createCallback(this)
			}];
	},//end of the initcomponents
	/**
	 * 初始化数据
	 * @param {} formPanel
	 */
	initData:function(){
		//加载表单对应的数据	
		if (this.id != null && this.id != 'undefined') {
			this.formPanel.getForm().load({
				deferredRender : false,
				url : __ctxPath + '/produce/getProjectAttendInfo.do?id='+ this.id,
				waitMsg : '正在载入数据...',
				success : function(form, action) {
						var jsonData = Ext.util.JSON.decode(action.response.responseText);
						var res = jsonData.data;
						//Ext.getCmp("").originalValue=
				},
				failure : function(form, action) {
				}
			});
		}
	},
	/**
	 * 重置
	 * @param {} formPanel
	 */
	reset:function(formPanel){
		formPanel.getForm().reset();
	},
	/**
	 * 取消
	 * @param {} window
	 */
	cancel:function(window){
		window.close();
	},
	/**
	 * 保存记录
	 */
	save:function(formPanel,window){
		if (formPanel.getForm().isValid()) {
			formPanel.getForm().submit({
				method : 'POST',
				waitMsg : '正在提交数据...',
				success : function(fp, action) {
					Ext.ux.Toast.msg('操作信息', '成功保存信息！');
					var gridPanel=Ext.getCmp('ProjectAttendInfoGrid');
					if(gridPanel!=null){
						gridPanel.getStore().reload();
					}
					window.close();
				},
				failure : function(fp, action) {
					Ext.MessageBox.show({
								title : '操作信息',
								msg : '信息保存出错，请联系管理员！',
								buttons : Ext.MessageBox.OK,
								icon : Ext.MessageBox.ERROR
							});
					//window.close();
				}
			});
		}
	}//end of save
	
});